<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<%@ taglib prefix="fn" uri="/WEB-INF/tlds/fn.tld"%>
<%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>采购商品单价及数量修改</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/datepicker/WdatePicker.js" type="text/javascript"></script>
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.validate.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/common/jquery.validate.method.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/common/jquery.form.js" type="text/javascript"></script>
<style type="text/css">
#searchbar{
	margin-bottom: 10px;
}
.navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search{
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>
<body style="padding:6px; overflow:hidden;">
<div id="">
	<div class="navbar"><span>您当前的位置：采购管理 &gt;采购单管理 &gt;采购商品单价及数量修改 </span></div>
	<br/>
	<form action="poProdPriceAndQuantityModify.do"  name="queryForm" id="queryForm" method="POST">
		<input type="hidden" id="poNo" name="poNo" value="${poProduct.poNo}">
		<input type="hidden" id="prodNo" name="prodNo" value="${poProduct.prodNo}">
		<table cellpadding="0" cellspacing="0" class="l-table-edit" >
		    <tr height="25">
		    	<td align="right">货品编号：</td>
		    	<td align="left" class="l-table-edit-td">${poProduct.prodNo}</td>
		    </tr>
		    <tr height="25">
		    	<td align="right">商品名称：</td>
		        <td align="left" class="l-table-edit-td">${fn:escapeXml(poProduct.commodityName)}</td>
		    </tr>
		    <tr height="25">
		    	<td align="right">规格：</td>
		    	<td align="left" class="l-table-edit-td">${fn:escapeXml(poProduct.specification)}</td>
		    </tr>
		    <tr height="25">
		    	<td align="right">供应商：</td>
		        <td align="left" class="l-table-edit-td">${fn:escapeXml(poProduct.purSuppName)}</td>
		    </tr>
		    <tr height="35">
		    	<td align="right">单价：</td>
		    	<td align="left" class="l-table-edit-td"><input type="text" id="purUnitPrice" name="purUnitPrice" value="${poProduct.purUnitPrice}" ></td>
		    </tr>
		    <tr height="35">
		    	<td align="right">数量：</td>
		        <td align="left" class="l-table-edit-td"><input type="text" id="purQuantity" name="purQuantity" value="${poProduct.purQuantity}" ></td>
		    </tr>
		</table><br>
		<input  type="submit" value="确定" class="l-button-search" style="margin-left: 70px;">&nbsp;&nbsp;&nbsp;&nbsp;<input  type="button" id="cancelButton" value="取消" class="l-button-search" >
	</form>
	<br/>
</div>
<div id="maingrid6" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- g data total ttt -->
</div>
<script type="text/javascript">
$(function (){
	var price = ${poProduct.purUnitPrice};
	$("#purUnitPrice").val(price.toFixed(2));
			//validate
		    $.metadata.setType("attr", "validate");
		    var v = $("form").validate({
		    	rules: {
		    		"purUnitPrice": {required: true,rangelength:[1,10],number:true,min:0},
		    		"purQuantity": {required: true,rangelength:[1,10],digits:true}
		    	},
		    	messages: {
		    		"purUnitPrice": {
		    			number: "请输入正确的单价",
		    			rangelength: jQuery.validator.format("请输入{0}-{1}位字符")
		    		},
		    		"purQuantity": {
		    			digits: "请输入正确的数量",
		    			rangelength: jQuery.validator.format("请输入{0}-{1}位字符")
		    		}
		    	},
		        errorPlacement: function (lable, element)
		        {
		        	lable.ligerHideTip();
		            if (element.hasClass("l-textarea"))
		            {
		                element.ligerTip({ content: lable.html(), target: element[0] }); 
		            }
		            else if (element.hasClass("l-text-field"))
		            {
		                element.parent().ligerTip({ content: lable.html(), target: element[0] });
		            }
		            else
		            {
		                lable.appendTo(element.parents("td:first").next("td"));
		            }
		        },
		        success: function (lable)
		        {
		            lable.ligerHideTip();
		            lable.remove();
		        },
		        submitHandler:function()
		        {
		            $("form .l-text,.l-textarea").ligerHideTip();
		            var options = {
		            		type: 'POST',
		            		success: function(data){
		            			if(!data || data.toLowerCase() == "fail") {
		            				//$.ligerDialog.alert("操作失败");
		            				$.ligerDialog.confirm('操作失败', function (yes) {parent.window.location.reload();});
		            				
		            			} else if(data.toLowerCase() == "success") {
		            				//$.ligerDialog.alert("操作成功");
		            				$.ligerDialog.confirm('操作成功', function (yes) { parent.window.location.reload(); });
		            				
		            			} else {
		            				//$.ligerDialog.alert(data);
		            				$.ligerDialog.confirm(data, function (yes) {parent.window.location.reload(); });
		            				
		            			};
		            		}
		            	}, $form1 = $("#queryForm");
		           $form1.ajaxSubmit(options);
		             return false;
		        }
		    });
		}); 
$("form").ligerForm();
// 取消
$("#cancelButton").click(function() {
	parent.window.location.reload();
});
</script>
</body>
</html>